#define DEBUG
#include <cstdio>
#define MAXN 50000

using namespace std;

int main() {
#ifdef DEBUG
  freopen("0.in", "r", stdin);
  freopen("0.out", "w", stdout);
#endif

  static int f[5][36][36][36][36], word[MAXN+1][5];
  int n, d;
  scanf("%d %d", &n, &d);
  for (int i=1; i<=n; i++) {
    char c;
    for (int j=1; j<=4; j++) {
      scanf(" %c ", &c);
      word[i][j]= '0'<=c && '9'>=c ? c-'0' : c-'a'+9;
      f[0][word[i][1]][word[i][2]][word[i][3]][word[i][4]]++;
    }
  }

  fclose(stdin);
  fclose(stdout);
  return 0;
}
